package com.gzzn.validate.support;

import com.gzzn.validate.internal.Rule;

/**
 * author : zdp（zdp118@gmail.com）
 * date   : 2014-3-12
 * 中国车牌号校验。支持民用军用警用车牌格式校验。
 */
public class VehicleLicensePlateValidate extends ValidateWithRegex {

    /**
     * 军队用汉字
     */
    static final String ARMY_CHARS = "军海空北沈南兰广成济";

    /**
     * 省、自治区、直辖市简称
     */
    static final String AREA_CHARS = "京津晋冀蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云藏陕甘青宁新渝";

    /**
     * 号牌分类汉字
     */
    static final String CARD_TYPE = "警学领试挂港澳超使练";

    public static final String FIRST_CHARSET = AREA_CHARS + ARMY_CHARS;

    public static final String LAST_CHARSET = CARD_TYPE;

    /**
     * 武警号牌特殊字符
     */
    static final String WJ_SPECIAL = "WJ[0-3]\\d";

    static final String LPN_REGEX = "^" +
            "["+
            AREA_CHARS +
            ARMY_CHARS+
            "]?" +
            "(" +
            "[A-Z]" +
            "|" +
            WJ_SPECIAL+
            ")-?" +
            "[" +
            "A-Z0-9" +
            CARD_TYPE+
            "]{5}$";
    static final String messageT = "Please enter a validate Vehicle License Plate number.";

    public VehicleLicensePlateValidate() {
        super(messageT,Rule.VehicleLicensePlate, LPN_REGEX);
    }
}
